<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSettingLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('setting_logs', function (Blueprint $table) {
            $table->charset = 'utf8';
            $table->collation = 'utf8_general_ci';
            $table->comment = '后台设置的操作记录表';
            $table->increments('id');
            $table->unsignedInteger('admin_id')->comment('对应admins表的id');
            $table->char("table_name",32)->default('')->index()->comment('操作的对应的表名');
            $table->unsignedInteger('table_id')->default(0)->comment('操作的表的id');
            $table->unsignedTinyInteger('operating_type')->comment('当前的操作类型 1 新增 2 修改 3 删除');
            $table->string('data')->default('')->comment('操作的记录');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('setting_logs');
    }
}
